package Person;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class jmu {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Set<String> arr = new TreeSet<String>();
        while(true){
            String str = sc.next();
            if(str.equals("!!!!!")){
                break;
            }
            arr.add(str);
        }
        if(arr.size()<10){
            for(String s:arr){
                System.out.println(s);
            }
        }else{
            int count=0;
            for(String s:arr){
                if(count++>9){
                    break;
                }
                System.out.println(s);
            }

        }



    }
}
